',} env. gateway, which defines the IP address of the gateway (transit, Bastion host), such as env. gateway = '2017. 168.1.1 'env. roledefs defines a role Group. for example, the web group and the db Group host are distinguished as follows: env. roledefs = {'webservers': ['2017. 168.1.21 ', '2017. 168.1.22 ', '2017. 168.1.23 '], 'dbservers': ['2017. 168.1.24 ', '2017. 168.1.25 '],}
The python modifier is used for reference. The task function below the role modifier is in its scope. The followin
= ' 192.168.1.1 '
Env.roledefs, define role groupings, such as web groups that are distinguished from the DB Group host, defined as follows:
Env.roledefs = {
' Webservers ': [' 192.168.1.21 ', ' 192.168.1.22 ', ' 192.168.1.23 '],
' Dbservers ': [' 192.168.1.24 ', ' 192.168.1.25 '],
}
Reference is done using the Python modifier, and the task function under the role modifier is its scope, and here's an example:
@roles (' webservers ')
def
As you can see from the name, this guy just opens the browser and browses the specified page.
It has two identical attributes: The URI attribute is of the system. Uri type, which is a newly written attribute;
The URL is of the string type, but if this attribute is used, a warning "expired" will be issued, so we recommend that you use the former.
In the following example, after clicking the button, the Web browser is opened and the address entered in the text box is located. However, the two at
layout summaryThis is probably the most comprehensive CSS adaptive layout summary in history.HTML,CSS Code SpecificationNEC: A better CSS style solutionTask 6: Caregiver List Page--A most common mobile page that requires the use of bootstrap1. Solve the vertical center; 2. Simulate the drop-down box; 3. Make a complex list pageSprite ChartBackground-position and Sprite diagram (CSS Sprites) usageBootstrap grid systemThe subtleties of the Bootstrap grid systemBootstrap official documentsBootstra
={' webserver ': [' 192.168.1.21 ', ' 192.168.1.22 '], ' dbserver ': [' 192.168.1.25 ', ' 192.168.1.26 ']}env.deploy_release_dir #自定义全局变量, format:env.+ ' variable name ', such as Env . Age,env.sex, etc. Examples of how to use Env.roledefs:Env.roledefs = {' webserver ': [' 192.168.1.21 ', ' 192.168.1.22 '], ' dbserver ': [' 192.168.1.25 ', ' 192.168.1.26 ']}# A python adorner is used to refer to a grouping, such as: @roles (' webserver ') def webtask (
In many cases, it is necessary to use timed scheduling, such as running a crawler at regular intervals to crawl new data, with quartz,spring task and timerSpring Task can compare it to a lightweight quartz, and it is simple to use, except that there is no need for additional packages outside of spring-related packagesRecommended use of annotation-style implementationsImport Org.springframework.scheduling.annotation.scheduled;import org.springframework.stereotype.component;@ Componentpublic class
': ['2017. 168.1.21 ', '2017. 168.1.22 '], 'dbserver': ['2017. 168.1.25 ', '2017. 168.1.26 ']} # Use the python modifier to reference A group, for example, @ roles ('webserver') def webtask (): run ('/usr/local/nginx/sbin/nginx') @ roles ('webserver', 'dbserver') def publictask (): run ('uptime ')
Common Fabric APIs
At the top of the simple example, the api function run is used. Next, we will list several common APIs.
Local # execute local commands, s
request = asynchronousresult. asyncstate As Httpwebrequest;Httpwebresponse response = request. endgetresponse (asynchronousresult) As Httpwebresponse; VaR S = response. getresponsestream (); VaR Reader = New Streamreader (s ); String Xmlfiletext = reader. readtoend (); This . Dispatcher. begininvoke () => {MessageBox. Show ( " Here is the XML data obtained by sl4: " + Xmlfiletext );});}
Then let's look at how to asynchronously obtain data through TPL. Of course, before that, we need using sy
, Java.lang.annotation.ElementType.ANNOTATION_TYPE}) @Retention (retentionpolicy.runtime) @Documented public @interface Scheduled { public abstract String cron (); public abstract long Fixeddelay (); public abstract long Fixedrate (); } Cron: indicates the specified cron expression. Fixeddelay: represents the interval from the beginning of the previous task completion to the start of the next task, in milliseconds. Fixedrate: represents the interval from the beginning
/init.d/nginxstart‘)@roles(‘dbservers‘):defdbtask():run(‘/etc/init.d/mysqlstart‘)@roles(‘webservers‘,‘dbservers‘)defpublictask():run(‘uptime‘)defdeploy():execute(webtask)execute(dbtask)execute(publictask)
Execute the command Fab deploy to execute different task functions for different roles.
Common APIs
Fabric provides a simple but powerful set of fabric. API commands, which can be called to meet most application scenarios. Fabric supports the followi
find that, under the/learn path of our domain name (for example, single sign-on to the login page), we have a special optimization: To facilitate our use of CMS to create each article. Because the article has no central index, but in order to be able to be found by the search engine, using the Webtask crawler to pre-render each page and generate a static version then upload to our CDN. This reduces our stress on the server side, because there is no n
within the scope of the scheduled task 3* /4 @Scheduled (cron = "0/3 * * * *?") )5 public void servicetask () {6 System.out.println ("Service **********"); 7 } timing Tasks for the controller layer:1 /**2 * Open the SPRINGMVC container Scan package within the range of scheduled tasks 3* /4 @Scheduled (cron = "0/6 * * * *?") )5 public void webtask () {6 System.out.println ("controller******
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.